package com.xneure.function;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.xneure.function.mode.Function;

public class FunctionCollect{
	private static final Map<String,Function> funMap = new ConcurrentHashMap<String,Function>(50);

	public static <T extends Function> void registerFunction(T fun){
		funMap.put(fun.getName().toLowerCase(),fun);
	}

	@SuppressWarnings("unchecked")
	public static <T extends Function> T getFunction(String funName){
		return (T)funMap.get(funName);
	}
}
